<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CKEditor5</title>
    <script src="/js/jquery-3.4.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="https://cdn.ckeditor.com/ckeditor5/18.0.0/classic/ckeditor.js"></script>
</head>
<body>

<div id="editor"></div>
<button id="btnSubmit">提交</button>

<script>
    var myEditor;
    ClassicEditor
        .create( document.querySelector( '#editor' ),
            {
                language: {
                    ui: 'zh-cn'
                },
                ckfinder: {
                    uploadUrl: '/attachment/upload2Server'
                }
            })
        .then(editor => {
            myEditor = editor;
            //data = editor.getData();
            //console.log(data);
        })
        .catch( error => {
        console.error( error );
    } );

    $("#btnSubmit").click(function(){
        var content = myEditor.getData();
        console.log(content);
    });
</script>

</body>
</html>